﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Text;
using Command;
using Command.HelpClass;
using Guestbook.IBiz;
using Guestbook.IDal;
//using Guestbook.Unity;
using IDAL;
using Moon.Orm;

namespace Guestbook.Biz
{
    public class BaseBiz<T> : IBaseBiz<T> where T :EntityBase, new()
    {
        private IBaseDao<T> _baseDal = new BaseDao<T>();

        public StringBuilder GetRemoveParametersSQL(WhereExpression expression)
        {
            return _baseDal.GetRemoveParametersSQL(expression);
        }

        public StringBuilder GetUpdateSQL(EntityBase entity)
        {
            return _baseDal.GetUpdateSQL(entity);
        }

        public StringBuilder GetAddSQL(EntityBase entity)
        {
            return _baseDal.GetAddSQL(entity);      
        }

        public object Add(EntityBase entity)
        {
            return _baseDal.Add(entity);
        }

        public int Update(EntityBase entity)
        {
            return _baseDal.Update(entity);

        }

        public int Remove(WhereExpression expression)
        {
            return _baseDal.Remove(expression);
        }

        public long GetCount(WhereExpression expression)
        {
            return _baseDal.GetCount(expression);
        }

        public long GetInt32Count(WhereExpression expression)
        {
            return _baseDal.GetInt32Count(expression);
        }

        public StringBuilder GetCountSQL(WhereExpression expression)
        {
            return _baseDal.GetCountSQL(expression);
        }

        public int Remove<T2>() where T2 : MQLBase
        {
            return _baseDal.Remove<T2>();
        }

        public List<T> GetEntities(MQLBase mql)
        {
            return _baseDal.GetEntities(mql);
        }

        public List<TG> GetOwnList<TG>(MQLBase mql) where TG : new()
        {
            return _baseDal.GetOwnList<TG>(mql);
        }

        public T GetEntity(MQLBase mql)
        {
            return _baseDal.GetEntity(mql);
        }

        public object ExecuteScalar(MQLBase mql)
        {
            throw new NotImplementedException();
        }

        public MObject ExecuteScalarToMObject(MQLBase mql)
        {
            throw new NotImplementedException();
        }

        public DataSet ExecuteProToDataSet(string procName, params DbParameter[] parameters)
        {
            return _baseDal.ExecuteProToDataSet(procName, parameters);
        }

        public int ExecuteProWithNonQuery(string procName, params DbParameter[] parameters)
        {
            return _baseDal.ExecuteProWithNonQuery(procName, parameters);
        }

        public List<T2> ExecuteProToOwnList<T2>(string procName, params DbParameter[] parameters) where T2 : new()
        {
            return _baseDal.ExecuteProToOwnList<T2>(procName, parameters);
        }

        public DataSet ExecuteSqlToDataSet(string sql)
        {
            return _baseDal.ExecuteSqlToDataSet(sql);
        }

        public DataSet ExecuteSqlToDataSet(string sql, params object[] values)
        {
            return _baseDal.ExecuteSqlToDataSet(sql, values);
        }

        public int ExecuteSqlWithNonQuery(string sql)
        {
            return _baseDal.ExecuteSqlWithNonQuery(sql);
        }

        public List<T2> ExecuteSqlToOwnList<T2>(string sql) where T2 : new()
        {
            return _baseDal.ExecuteSqlToOwnList<T2>(sql);
        }

        public List<T2> ExecuteSqlToOwnList<T2>(string sql, params object[] values) where T2 : new()
        {
            return _baseDal.ExecuteSqlToOwnList<T2>(sql,values);
        }

        public int ExecuteSqlWithNonQuery(string sql, params object[] values)
        {
            return _baseDal.ExecuteSqlWithNonQuery(sql, values);
        }

        public List<Dictionary<string, MObject>> ExecuteSqlToDictionaryList(string sql, params object[] values)
        {
            return _baseDal.ExecuteSqlToDictionaryList(sql, values);
        }

        public List<Dictionary<string, MObject>> ExecuteSqlToDictionaryList(string sql)
        {
            return _baseDal.ExecuteSqlToDictionaryList(sql);
        }

        public List<Dictionary<string, MObject>> GetDictionaryList(MQLBase mql)
        {
            return _baseDal.GetDictionaryList(mql);
        }

        public List<T2> GetPagingData<T2>(PageClass pc) where T2 : new()
        {
            return _baseDal.GetPagingData<T2>(pc);
        }

        public int GetCountSQL(string sqltable, string sqlwhere)
        {
            return _baseDal.GetCountSQL(sqltable, sqlwhere);
        }

        public DbDataReader GetDbDataReader(string commandText, CommandType type)
        {
            return _baseDal.GetDbDataReader(commandText, type);
        }

        public object GetDynamicList(string sql, string classname)
        {
            return _baseDal.GetDynamicList(sql, classname);
        }

        public object GetScalar(MQLBase mql)
        {
            return _baseDal.GetScalar(mql);
        }

        public MObject GetScalarToMObject(MQLBase mql)
        {
            return _baseDal.GetScalarToMObject(mql);
        }


        public object GetModelBySql(string sql, string classname)
        {
            return _baseDal.GetModelBySql(sql, classname);
        }
    }
}
